﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApprovedMaterialsInProcess.aspx.cs" Inherits="MLY.LTR.ApprovedMaterialsInProcess" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Process Report</title>
    <style type="text/css">
        .TitleStyle
        {
            font-family:Arial Sans-Serif David;
            font-size:14px;
            font-weight:bold;
            color:Black;
        }
        .InerTextStyle
        {
            font-family:Arial Sans-Serif David;
            font-size:12px;
            color:Black;
        }
    </style>
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="ActualUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate> 
        <asp:Label ID="ActualTitleLabel" runat="server" CssClass="TitleStyle"
        Text="With Actual, but without supplier approval"></asp:Label>
        <br />
        <div class="InerTextStyle">
        <table style="width:100%;">
        <tr>
        <td style="width:15%; vertical-align:top;">
            
            <asp:Label ID="ActualDDLTitleLabel" runat="server" CssClass="InerTextStyle"
             Text="Days since actual delivery date"></asp:Label>              
            <br />   
            <asp:DropDownList ID="ActualDropDownList" runat="server" OnSelectedIndexChanged="ActualRefresh" AutoPostBack="true">
                <asp:ListItem Text="הכל" Value="0"></asp:ListItem>
                <asp:ListItem Text="יום אחד" Value="1"></asp:ListItem>
                <asp:ListItem Text="יומיים" Value="2"></asp:ListItem>
                <asp:ListItem Text="3 ימים" Value="3" Selected="True"></asp:ListItem>
                <asp:ListItem Text="4 ימים" Value="4"></asp:ListItem>
                <asp:ListItem Text="5 ימים" Value="5"></asp:ListItem>
                <asp:ListItem Text="6 ימים" Value="6"></asp:ListItem>
                <asp:ListItem Text="7 ימים" Value="7"></asp:ListItem>
                <asp:ListItem Text="8 ימים" Value="8"></asp:ListItem>
                <asp:ListItem Text="9 ימים" Value="9"></asp:ListItem>
                <asp:ListItem Text="10 ימים" Value="10"></asp:ListItem>
                <asp:ListItem Text="11 ימים" Value="11"></asp:ListItem>
                <asp:ListItem Text="12 ימים" Value="12"></asp:ListItem>
                <asp:ListItem Text="13 ימים" Value="13"></asp:ListItem>
                <asp:ListItem Text="14 ימים" Value="14"></asp:ListItem>
                <asp:ListItem Text="15 ימים" Value="15"></asp:ListItem>
                <asp:ListItem Text="16 ימים" Value="16"></asp:ListItem>
                <asp:ListItem Text="17 ימים" Value="17"></asp:ListItem>
                <asp:ListItem Text="18 ימים" Value="18"></asp:ListItem>
                <asp:ListItem Text="19 ימים" Value="19"></asp:ListItem>
                <asp:ListItem Text="20 ימים" Value="20"></asp:ListItem>
            </asp:DropDownList>
            <br />
            <br />
                <asp:Label ID="ActualYesNoTitleLabel" runat="server" Text="Customer catalogue Code:" CssClass="InerTextStyle"></asp:Label>
                <asp:DropDownList ID="ActualYesNoDDL" runat="server" OnSelectedIndexChanged="ActualRefresh" AutoPostBack="true">
                    <asp:ListItem Selected="True" Text="All" Value="All"></asp:ListItem>
                    <asp:ListItem Text="Yes only" Value="Yes"></asp:ListItem>
                    <asp:ListItem Text="No only" Value="No"></asp:ListItem>
                </asp:DropDownList>
            <br />
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="ActualUpdatePanel">
            <ProgressTemplate>
                <asp:Label ID="Report1ProgresLabel" runat="server" Text="Loading..." CssClass="InerTextStyle"></asp:Label>
            </ProgressTemplate>
            </asp:UpdateProgress>
            <asp:ImageButton ID="ExportToExcel1" runat="server" ImageUrl="~/Images/excel.gif" OnClick="ExportToExcel" />
        </td>
        <td style="width:85%; vertical-align:top;">
        
            <asp:GridView ID="ActualGridview" runat="server" AutoGenerateColumns="false" AllowPaging="false"
             DataSourceID="ActualDataSource">
                <Columns>
                    <asp:BoundField DataField="CustomerWorkOrderNumber" HeaderText="Work order number" 
                     HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%"/>
                    <asp:BoundField DataField="ContractorWorkOrderNumber" HeaderText="Contractor Order Number" 
                     HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%"/>
                    <asp:BoundField DataField="CustomerCatalougeCode" HeaderText="Customer catalogue code" 
                    HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%" />
                    <asp:TemplateField HeaderText="Time since actual delivery" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# CalculateTimeSince(Eval("ActualDelivaryDate"))%>
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Days overdue" ItemStyle-Width="7%" >
                    <HeaderStyle BackColor="#86C2FF" />
                    <ItemTemplate>
                    <%# CalculateOverdueTime(Eval("ActualDelivaryDate"), "1")%>
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Send Date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("SendDate")) %>
                    </ItemTemplate>        
                           
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Requested delivery date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("RequestedDelivaryDate"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Planned delivery date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("PlannedDelivaryDate"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Actual delivery date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("ActualDelivaryDate"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:BoundField DataField="OrderNumber" HeaderText="Contractor order number" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%" />
                    <asp:BoundField DataField="TextFieldA" HeaderText="Customer Service Manager" 
                    HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%" />
                    <asp:BoundField DataField="TextFieldB" HeaderText="$"
                     HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%" />
                     <asp:BoundField DataField="TextFieldC" HeaderText="<%$ Dict:TextFieldC %>" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%"  />
                    
                    <asp:TemplateField HeaderText="Supplier Approval" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("DateFieldA"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Customer Approval" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("DateFieldB"))%>
                    </ItemTemplate>
                    </asp:TemplateField>                
                </Columns>
            </asp:GridView>            
        </td>
        </tr>
        </table>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="ExportToExcel1" />
        </Triggers>
        </asp:UpdatePanel> 
        
        </div>        
        <br /><br />
        <asp:Label ID="SupplierApprovalTitleLabel" runat="server" CssClass="TitleStyle"
        Text="With Supplier approval"></asp:Label>
        <br />
        <div class="InerTextStyle">
        <asp:UpdatePanel ID="SupplierApprovalUpdatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate> 
        <table style="width:100%;">
        <tr>
        <td style="width:15%; vertical-align:top;">
            <asp:Label ID="SupplierApprovalDDLTitleLabel" runat="server" CssClass="InerTextStyle"
             Text="Days since supplier approval"></asp:Label>    
            <br />
            <asp:DropDownList ID="SupplierApprovalDropDownList" runat="server" OnSelectedIndexChanged="SupplierApprovalRefresh" AutoPostBack="true">
                <asp:ListItem Text="הכל" Value="0"></asp:ListItem>
                <asp:ListItem Text="יום אחד" Value="1"></asp:ListItem>
                <asp:ListItem Text="יומיים" Value="2"></asp:ListItem>
                <asp:ListItem Text="3 ימים" Value="3" Selected="True"></asp:ListItem>
                <asp:ListItem Text="4 ימים" Value="4"></asp:ListItem>
                <asp:ListItem Text="5 ימים" Value="5"></asp:ListItem>
                <asp:ListItem Text="6 ימים" Value="6"></asp:ListItem>
                <asp:ListItem Text="7 ימים" Value="7"></asp:ListItem>
                <asp:ListItem Text="8 ימים" Value="8"></asp:ListItem>
                <asp:ListItem Text="9 ימים" Value="9"></asp:ListItem>
                <asp:ListItem Text="10 ימים" Value="10"></asp:ListItem>
                <asp:ListItem Text="11 ימים" Value="11"></asp:ListItem>
                <asp:ListItem Text="12 ימים" Value="12"></asp:ListItem>
                <asp:ListItem Text="13 ימים" Value="13"></asp:ListItem>
                <asp:ListItem Text="14 ימים" Value="14"></asp:ListItem>
                <asp:ListItem Text="15 ימים" Value="15"></asp:ListItem>
                <asp:ListItem Text="16 ימים" Value="16"></asp:ListItem>
                <asp:ListItem Text="17 ימים" Value="17"></asp:ListItem>
                <asp:ListItem Text="18 ימים" Value="18"></asp:ListItem>
                <asp:ListItem Text="19 ימים" Value="19"></asp:ListItem>
                <asp:ListItem Text="20 ימים" Value="20"></asp:ListItem>
            </asp:DropDownList>
            <br /><br />
                <asp:Label ID="SupplierApprovalYesNoTitleLabel" runat="server" Text="Customer catalogue Code:" CssClass="InerTextStyle"></asp:Label>
                <asp:DropDownList ID="SupplierApprovalYeNoDDL" runat="server" OnSelectedIndexChanged="SupplierApprovalRefresh" AutoPostBack="true">
                    <asp:ListItem Selected="True" Text="All" Value="All"></asp:ListItem>
                    <asp:ListItem Text="Yes only" Value="Yes"></asp:ListItem>
                    <asp:ListItem Text="No only" Value="No"></asp:ListItem>
                </asp:DropDownList>
            <br />
            <asp:ImageButton ID="ExportToExcel2" runat="server" ImageUrl="~/Images/excel.gif" OnClick="ExportToExcel" />
            <asp:UpdateProgress ID="Report1UpdateProgress" runat="server" AssociatedUpdatePanelID="SupplierApprovalUpdatePanel">
            <ProgressTemplate>
                <asp:Label ID="Report2ProgresLabel" runat="server" Text="Loading..." CssClass="InerTextStyle"></asp:Label>
            </ProgressTemplate>
            </asp:UpdateProgress>
            
            
        </td>
        <td style="width:85%; vertical-align:top;">
            <asp:GridView ID="SupplierApprovalGrid" runat="server" AutoGenerateColumns="false" AllowPaging="false"
             DataSourceID="SupplierApprovalDataSource">
                <Columns>
                    <asp:BoundField DataField="CustomerWorkOrderNumber" HeaderText="Work order number" 
                     HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%"/>
                    <asp:BoundField DataField="ContractorWorkOrderNumber" HeaderText="Contractor Order Number" 
                     HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%"/>
                    <asp:BoundField DataField="CustomerCatalougeCode" HeaderText="Customer catalogue code" 
                    HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%" />
                    <asp:TemplateField HeaderText="Time since approval" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# CalculateTimeSince(Eval("DateFieldA"))%>
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Days overdue" ItemStyle-Width="7%" >
                    <HeaderStyle BackColor="#86C2FF" />
                    <ItemTemplate>
                    <%# CalculateOverdueTime(Eval("DateFieldA"), "2")%>
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Send Date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("SendDate")) %>
                    </ItemTemplate>        
                           
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Requested delivery date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("RequestedDelivaryDate"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Planned delivery date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("PlannedDelivaryDate"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Actual delivery date" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("ActualDelivaryDate"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:BoundField DataField="OrderNumber" HeaderText="Contractor order number" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="7%" />
                    <asp:BoundField DataField="TextFieldA" HeaderText="Customer Service Manager" 
                    HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%" />
                    <asp:BoundField DataField="TextFieldB" HeaderText="$"
                     HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%" />
                     <asp:BoundField DataField="TextFieldC" HeaderText="<%$ Dict:TextFieldC %>" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%"  />
                    
                    <asp:TemplateField HeaderText="Supplier Approval" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("DateFieldA"))%>
                    </ItemTemplate>                
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Customer Approval" HeaderStyle-BackColor="#86C2FF" ItemStyle-Width="6%">
                    <ItemTemplate>
                    <%# FormatDate(Eval("DateFieldB"))%>
                    </ItemTemplate>
                    </asp:TemplateField>                
                </Columns>
            </asp:GridView>
        </td>
        </tr>
        </table>
        
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="ExportToExcel2" />
        </Triggers>
        </asp:UpdatePanel> 
        </div>
        <asp:SqlDataSource ID="ActualDataSource" runat="server" SelectCommandType="StoredProcedure"
        ConnectionString="<%$ ConnectionStrings:MLYConnectionString %>" 
        SelectCommand="ActualMaterialsReport_Actual"></asp:SqlDataSource>   
        <asp:SqlDataSource ID="SupplierApprovalDataSource" runat="server" SelectCommandType="StoredProcedure"
        ConnectionString="<%$ ConnectionStrings:MLYConnectionString %>" 
        SelectCommand="ActualMaterialsReport_SupplierApproval"></asp:SqlDataSource>   
    
    </form>
</body>
</html>
